package com.delio.client.pagos.empleados;

import com.delio.client.idioma.DelioConstants;
import com.delio.client.pagos.contratos.PanelNuevoContrato;
import com.delio.client.util.Orientacion;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.google.gwt.core.client.GWT;

public class PanelContratoEmpleado extends FormPanel {
	private DelioConstants k = GWT.create(DelioConstants.class);

	private Button btnRegistrar;

	PanelNuevoEmpleado panelnuevoempleo;
	private static PanelNuevoContrato panelnuevocontrato;

	private FormButtonBinding formbuttonbinding;

	public PanelContratoEmpleado() {
		super();
		setPadding(0);
		setFrame(true);
		setLayout(new BorderLayout());
		setHeading(k.NuevoEmpleado());

		PanelGridEmpleado.panelcontratoempleado=PanelContratoEmpleado.this;
		
				
		panelnuevoempleo = new PanelNuevoEmpleado();
		panelnuevocontrato = new PanelNuevoContrato();

		add(panelnuevoempleo, new Orientacion(200, LayoutRegion.NORTH));
		add(panelnuevocontrato, new Orientacion(LayoutRegion.CENTER));

		btnRegistrar = new Button(k.registrar(),IconHelper.createPath("images/icons/save_all.png"));
		btnRegistrar.setSize(80, 30);
		
		btnRegistrar.addSelectionListener(new SelectionListener<ButtonEvent>() {
			@Override
			public void componentSelected(ButtonEvent ce) {
				panelnuevoempleo.save();
			}
		});
		
		formbuttonbinding = new FormButtonBinding(this);
		formbuttonbinding.addButton(btnRegistrar);

		addButton(btnRegistrar);
		setButtonAlign(HorizontalAlignment.CENTER);

	}


	public void nuevoHeader(){
		setHeading(k.NuevoEmpleado());
		
	}
	
	public void  modificarHeader(){
		setHeading(k.ModificarEmpleado());
	}
}
